package me.sdevil507.org.po;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import me.sdevil507.supports.jpa.BaseJpaSnowflakeIdEntity;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;

/**
 * 机构与用户关联关系Po
 *
 * @author sdevil507
 * created on 2020/7/14
 */
@EqualsAndHashCode(callSuper = true, exclude = {"org", "user"})
@Entity
@Table(name = "biz_org_user_rel")
@ToString(exclude = {"org", "user"})
@Data
public class OrgUserRelPo extends BaseJpaSnowflakeIdEntity {

//    /**
//     * 对应机构
//     */
//    @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.ALL)
//    @JoinColumn(name = "org_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
//    private OrgPo org;

    /**
     * 对应部门
     */
    @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.ALL)
    @JoinColumn(name = "org_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private OrgDeptPo org;

    /**
     * 对应用户
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private OrgUserPo user;

    /**
     * 是否是专家
     */
    @Column
    private boolean expert;

    /**
     * 是否是管理员
     */
    @Column
    private boolean mgr;

    /**
     * 是否是全职专家
     */
    @Column
    private boolean fullTime;

    /**
     * 是否领军人物
     */
    @Column
    private Boolean leader;

}
